package com.ruoyi.api.utils;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

@Configuration
public class AsyncConfig {

    @Bean
    public ThreadPoolTaskExecutor asyncTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(10); // 根据需求进行配置
        executor.setMaxPoolSize(50); // 根据需求进行配置
        executor.setQueueCapacity(100); // 根据需求进行配置
        executor.setThreadNamePrefix("async-task-");
        executor.initialize();
        return executor;
    }

}
